package com.searchtree.main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.Reader;
import java.io.StreamTokenizer;

public class FileExtractor 
{

	public void extractFile(File f) 
	{
		try 
		{
			Reader r = new BufferedReader(new FileReader(f));
			StreamTokenizer st = new StreamTokenizer(r);

			st.lowerCaseMode(true);
			st.whitespaceChars(',', '.');
			st.nextToken();
			
			while (st.ttype != StreamTokenizer.TT_EOF) 
			{
				if (st.ttype == StreamTokenizer.TT_WORD) 
				{
					Main.useKey(st.sval);
				}
				st.nextToken();
			}
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
		}
	}
}
